/* Import all components */
@import 'themes/default/globals/site.variables';
@import 'themes/pxt/globals/site.variables';

/* Reference import */
@import (reference) "semantic.less";

.ui.button.editortools-btn.editortools-github-btn {
    margin-left: 0.25rem;
    width: 4rem;
}

/* Mobile only */
@media only screen and (max-width: @largestMobileScreen) {
    .ui.button.editortools-btn.editortools-github-btn {
        margin-left: 0;
        margin-right: 0.25rem;
        width: auto;
    }
}

/*-------------------
   Github view and diffs
--------------------*/

table.diffview {
    border: 0px;
    border-spacing: 0px;
    border-collapse: collapse;
    width: 100%;

    .change code {
        white-space: pre;
    }

    .diff-added {
        background: @diffAddedBackground;

        .ch-added {
            background: @diffAddedTokenBackground;
        }
    }

    .diff-removed {
        background: @diffRemovedBackground;

        .ch-removed {
            background: @diffRemovedTokenBackground;
        }
    }

    .diff-marker {
        background: @diffMarkerBackground;
        color: @diffMarkerColor
    }

    .diff-marker td {
        padding-left: 1em;
    }

    tr.conflict {
        border-left: 2px solid @conflictBorderColor;
        border-right: 2px solid @conflictBorderColor;
    }
    tr.conflict.header {
        border-top: 2px solid @conflictBorderColor;
        border-bottom: 2px solid @conflictBorderColor;
        background-color: @conflictHeaderBackgroundColor;
    }
    tr.conflict.header td {
        color: @conflictHeaderColor;
    }
    tr.conflict td.ui {
        padding-left: 0.5rem;
        padding-top: 0.5rem;
    }

    tr.conflict.footer {
        border-bottom: 2px solid @conflictBorderColor;
    }

    .line-a,
    .line-b {
        width: 3em;
        text-align: right;
        color: @diffLineNumberColor;
    }

    .marker {
        width: 2.5em;
        text-align: center;
    }

    .change {
        text-align: left;
    }

    .diff-added .line-b:before,
    .diff-removed .line-a:before,
    .diff-unchanged .line-a:before,
    .diff-unchanged .line-b:before {
        content: attr(data-content);
    }

    .marker:before {
        content: attr(data-content);
    }
}

#githubEditor {
    background-color: @githubBackgroundColor;
    color: @githubTextColor;
    overflow-x: hidden;
    overflow-y: auto;
    #githubArea {
        height: 90%;
        padding: 1rem;

        .ui.link {
            cursor: pointer;
        }

        .ui.message span.ui.link {
            margin-left: 0.25rem;
            text-decoration: underline;
        }

        .inline-help {
            margin-left: 2rem;
        }

        .ui.divider {
            margin-bottom: 5px;
        }

        .ui.segment.diff {
            padding: 0;
        }

        .ui.segments {
            margin: 1rem 0;
        }

        .diffheader>span {
            font-weight: bold;
            font-size: 1.2em;
        }

        .diffheader .ui.button {
            float: right;
            margin-top: -0.5em;
        }

        .ui.segment.diff svg {
            margin: 1rem;
            max-width: calc(100% - 2rem);
        }

        .ui.segments.filediff {
            background: @diffSegmentBackgroundColor;        
        }

        .legend > span:not(:first-child) {
            margin-left: 1.5rem;
        }

        .legend span.icon {
            width: 0.8rem;
            height: 0.8rem;
            display: inline-block;
            border-radius: 2px;
            margin-right: 0.25rem;
        }

        .legend span.added.icon {
            background: linear-gradient(45deg, orange , yellow, green, cyan, blue, violet);
        }

        .legend span.deleted.icon {
            background-color: #d0d04e;
            background-image: linear-gradient(45deg, #bbbbbb 25%, transparent 25%, transparent 75%, #bbbbbb 75%, #bbbbbb),
            linear-gradient(-45deg, #bbbbbb 25%, transparent 25%, transparent 75%, #bbbbbb 75%, #bbbbbb);
            background-size: 4px 4px;
        }

        .legend span.notchanged.icon {
            background: #d0d0d0;
        }

        .repo-branch {
            opacity: 0.4;
            cursor: pointer;
        }

        .join {
            text-align: center;
        }

        .create-pr {
            float: right;
        }
    }
}

// inverted style
.inverted-theme {
    #githubEditor {
        color: @githubInvertedTextColor;

        .diffview .change code {
            color: @githubInvertedTextColor;
        }

        .diff-added {
            background: @diffInvertedAddedBackground;
    
            .ch-added {
                background: @diffInvertedAddedTokenBackground;
            }
        }
    
        .diff-removed {
            background: @diffInvertedRemovedBackground;
    
            .ch-removed {
                background: @diffInvertedRemovedTokenBackground;
            }
        }
    
        .line-a,
        .line-b {
            color: @diffInvertedLineNumberColor;
        } 

        .diff-marker {
            background: @diffInvertedMarkerBackground;
            color: @diffInvertedMarkerColor
        }
    }
}